package io.zhengsh;

import io.zhengsh.thread.WorkThread;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class JueJunClient {
    private static ExecutorService threadPool200 = Executors.newFixedThreadPool(4);


    public static void main(String[] args) {
        try {
            Map<String, List<String>> map = JueJinList.readHtml2UrlMap();
            for (int i = 0; i < 2; i++) {
                threadPool200.submit(new WorkThread(map));
            }
            threadPool200.shutdown();
            System.out.println("shutdown()：启动一次顺序关闭，执行以前提交的任务，但不接受新任务。");
            while (true) {
                if (threadPool200.isTerminated()) {
                    System.out.println("所有的子线程都结束了！");
                    break;
                }
                Thread.sleep(1000);
            }

        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}
